//
// Created by wwl on 2021/12/10.
//
#include <stdio.h>
struct member {
    int num;
    struct member *next;
};
typedef struct member Member;

int insertup(Member *head,Member *newp){
    Member *pre, *suc;
    pre = head;
    suc = head->next;
    while (suc != NULL){

        //插头的第二个位置
        if (suc->num >= newp->num) {
            newp->next = head->next;
        }
        pre = suc;
        suc = suc->next;
    }
        //插头
      suc = newp;
      head->next = suc;
        //插尾
//        newp->next = pre->next;
//        pre->next = newp;


}
int print2(Member *head){
    Member *pt;
    pt = head;
    if(head != NULL){
        do {
            printf("%d \n",pt->num);
            pt = pt->next;
        } while (pt != NULL);
    }
}

void lianbiao() {
        Member a,b,c,new;
        Member *head,*newp;
        a.num = 5;
        b.num = 4;
        c.num = 3;
        head = &a;
        a.next = &b;
        b.next = &c;
        c.next = NULL;
        new.num = 1;
        new.next = NULL;
        newp = &new;
        insertup(head,newp);
        print2(head);
}

